package com.huanghao.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.huanghao.pojo.Commod;
import com.huanghao.pojo.User;

@Mapper
@Repository
public interface UserMapper {

	@Select("select * from user where  flag = 1")
	List<User> list();

	@Delete("update user set flag=0 where uId=#{uId}")
	void deletByid(Integer id);

    @Insert("INSERT INTO user(uName,uPassword,uPhone,uAddress,uSex,uNumber,flag) VALUES(#{uName},#{uPassword},#{uPhone},#{uAddress},#{uSex},#{uNumber},1)")
	void add(User user);

	void update(User user);

    @Select("select * from user where uId=#{uId} and uPassword=#{uPassword}")
	User getByUsernameAndPassword(User user);

    @Select("select * from user where uId = #{id} and flag = 1")
	User getById(Integer id);

}
